package com.netspider;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.Random;
import java.util.concurrent.TimeUnit;

import javax.imageio.ImageIO;

import org.jsoup.Jsoup;

import cn.hutool.core.img.ImgUtil;

public class Test {
	public static void run(String item) {
		String baseUrl = "https://mnks.jxedt.com";
		StringBuilder builder = new StringBuilder();
		try {
			TimeUnit.MILLISECONDS.sleep(new Random().nextInt(500));
			Random random = new Random();
			String url = baseUrl + "/get_question?r=" + random.nextDouble() + "&index=" + item;
			System.out.println("当前访问的地址为：" + url);
			String json = Jsoup.connect(url).
					userAgent("Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36")
					//"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36")
					//.header("Connection", "close")
					.cookie("JSESSIONID", "id58=c5/nfGDxOVwQmiDZBAtaAg==; 58tj_uuid=343927b1-e70c-4f91-904a-1511c4c59f75; new_uv=1; Hm_lvt_b54f0f8b3b75a8b7486c9adedf28f361=1626421603; jxedt_dialog_time=29596758; local_car_flag=ckm; als=0; local_car=%E6%91%A9%E6%89%98%E8%BD%A6; Hm_lvt_e584a1042d8500ea083f2ec69c5abfae=1626421641; Hm_lpvt_e584a1042d8500ea083f2ec69c5abfae=1626422470; Hm_lpvt_b54f0f8b3b75a8b7486c9adedf28f361=1626422809")
					.timeout(3000).get().body().text();
			builder.append(json).append("\r\n");
			System.out.println(builder.toString());
			
		} catch (Exception e) {
			e.printStackTrace();
		} finally {

		}
	}
	
	public static void test() {
		//String item = "1168,1204,1227,1416,1396,1238,1478,1417,1449,1161,1140,1523,1459,1495,1467,1499,1325,1193,1265,1469,1302,1317,1183,1394,1300,1283,1403,1307,1234,1299,1431,1533,1423,1353,1252,1209,1264,1344,1441,1242,1192,1213,1177,1137,1532,1205,1347,1411,1181,1184,1463,1210,1418,1355,1331,1430,1230,1451,1311,1382,1233,1497,1508,1364,1228,1246,1486,1277,1281,1352,1465,1267,1385,1319,1293,1348,1447,1149,1505,1484,1159,1362,1359,1218,1276,1439,1206,1190,1475,1327,1379,1179,1321,1224,1316,1328,1402,1291,1312,1350,1147,1144,1413,1150,1521,1284,1195,1290,1160,1378,1332,1226,1513,1368,1301,1345,1387,1445,1342,1189,1383,1182,1442,1367,1358,1473,1198,1488,1241,1500,1257,1261,1172,1145,1376,1405,1388,1285,1215,1535,1153,1146,1208,1450,1259,1239,1200,1292,1341,1476,1425,1175,1323,1274,1214,1438,1519,1361,1504,1236,1392,1141,1222,1306,1243,1474,1298,1437,1273,1436,1278,1391,1266,1514,1220,1308,1334,1440,1419,1262,1250,1398,1223,1455,1432,1143,1395,1248,1158,1304,1360,1148,1458,1269,1247,1404,1371,1263,1169,1163,1313,1296,1480,1333,1491,1258,1288,1462,1203,1187,1165,1429,1315,1322,1320,1229,1443,1399,1346,1318,1400,1196,1389,1268,1520,1314,1482,1369,1157,1254,1406,1370,1294,1155,1494,1180,1466,1289,1375,1221,1464,1502,1426,1335,1337,1493,1138,1460,1260,1470,1237,1428,1498,1176,1287,1415,1522,1525,1490,1503,1435,1472,1326,1197,1366,1516,1496,1526,1212,1531,1446,1517,1518,1194,1511,1381,1414,1271,1452,1178,1534,1479,1421,1393,1282,1477,1412,1434,1279,1506,1303,1377,1199,1297,1483,1219,1295,1309,1162,1409,1171,1444,1390,1174,1232,1151,1481,1373,1524,1487,1231,1170,1384,1286,1510,1173,1154,1202,1422,1235,1454,1448,1351,1338,1530,1270,1456,1528,1357,1339,1453,1245,1166,1310,1225,1164,1492,1489,1191,1330,1201,1380,1275,1305,1468,1397,1207,1457,1515,1255,1336,1420,1372,1272,1244,1188,1354,1256,1424,1349,1167,1343,1340,1527,1324,1485,1374,1356,1152,1251,1512,1386,1186,1471,1139,1363,1507,1216,1211,1142,1329,1156,1240,1501,1217,1401,1365,1536,1185,1408,1253,1461,1433,1410,1529,1509,1249,1280,1407,1427";
		String item = "26606,26615,1522,1420,1178,1430,26601,1170,1464,1377,1475,26593,1487,1315,1421,1194,1285,26599,1254,26597,1394,1244,1452,1197,1432,1150,1343,1517,1144,1252,1334,26619,1276,1470,26585,1184,1145,26596,26610,1220,1410,1266,1158,26589,1351,1403,1245,1210,1306,1424,26600,1507,1443,1536,1423,1482,1338,1495,1458,1188,1273,1277,1447,1137,1521,1241,1366,1186,1531,1196,26584,1525,1249,1265,1412,1433,1278,1143,1460,1526,1295,1429,1509,1256,1384,1453,1281,1314,1227,1316,1524,1205,1172,1286,1483,1159,1298,1291,1492,1233,1355,1260,1238,26623,1280,1180,1441,1207,1209,1459,1378,1328,1514,1494,1239,1532,1339,1154,1282,1496,1342,26621,1434,26607,1372,1375,1395,1346,1201,1380,1206,1454,1177,1152,1426,1484,1299,1428,1138,1329,1340,1161,1237,26590,1425,26611,1520,26587,26628,1213,1271,1527,1479,1530,1175,1371,1374,1436,1208,1352,1195,1166,1275,26624,26637,26630,1163,1190,1293,26634,1139,1225,1357,1391,1463,1345,1504,26622,1392,1142,1478,1396,1231,1173,26604,1189,1485,26588,1359,1473,1385,1204,1404,1362,1508,1289,26625,1397,1242,26612,1268,1191,1356,1511,1162,1171,1465,1288,1214,1350,1301,1222,26632,1360,1337,1512,1226,1390,1274,26586,1148,1217,1272,1183,1318,26613,1405,1259,1174,1393,1198,1308,1300,1363,1141,1408,1493,1262,1165,1462,1456,1325,1498,1212,1368,26603,1474,1367,1467,1193,26595,1253,1203,1269,1200,1182,1181,1202,1230,1218,1294,1320,1232,1287,1505,1247,1451,1270,1480,1331,1499,1341,1389,1309,1488,1228,1330,1506,1336,1400,1347,1379,1349,1307,1418,1305,1312,26618,1322,1439,1215,1223,1461,1296,1388,1419,1497,26594,1516,1373,1409,1199,1386,1332,1264,1153,1406,1471,26620,1445,1413,1267,1284,1446,1235,1534,26608,1160,1481,1444,1261,1376,1224,1449,1147,1321,1477,1427,26629,1438,26592,1518,1535,1455,1457,1234,1140,1353,26633,26636,1381,1167,1236,1327,1229,1490,26617,1313,1468,1422,26627,1358,1364,1221,1283,1523,1411,1326,1317,1246,1292,1250,1176,26591,1437,1414,1402,26626,1216,1491,1442,1354,1155,1369,1466,1263,26614,1469,1401,1187,1431,1529,1257,1365,1169,1251,1149,1387,1333,26616,1370,1361,1515,1248,1533,1472,1510,1311,1219,26605,1415,1335,1243,1324,26609,1156,26635,1323,1528,1399,1344,1185,1417,1398,1448,1501,1348,1489,1416,1486,1450,1502,1319,1279,1513,26631,1440,1151,1304,1500,1164,1303,1435,26602,1383,26598,1255,1179,1503,1258,1407,1476,1519,1302,1382,1168,1297,1290,1157,1240,1211,1146,1192,1310";
		String[] split = item.split(",");
		for (int i = 0; i < split.length; i++) {
			Test.run(split[i]);
		}
		
	}
	
	public void img() {
		BufferedImage read;
		try {
			read = ImgUtil.read(new URL("https://wos.58cdn.com.cn/XyVuTsRqXyf/question/5eb4d75agw1e290k8v86cj.jpg"));
			ImageIO.write(read, "jpg", new File("D:/wangweiji.jpg"));

		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
	}
	
	public static void main(String[] args) {
		Test.test();
	}
}
